<?php
namespace Home\Model;

use Think\Model;

class ScreeningModel extends Model
{
     public function getAll($data){
         $list=$this->add($data);
         return $list;
     }
     public function setAll($id,$limt){
         $list=$this->field('m.name mname,m.cover mc,r.name rname,cre.showtime ctime,cre.price cp,cre.id cid')->
         table('pre_movie m,pre_room r,pre_screening cre')->
         where('cre.movie_id=m.id and cre.room_id=r.id and cre.user_id='.$id)->limit($limt)->select();
          foreach($list as $key => $value){
             $list[$key]['mc']=$this->substr($value['mc']).$value['mc'];
         }
         return $list;
     }
    public function substr($filename)
    {
        return substr($filename,0,4).'/'.substr($filename,4,2).'/'.substr($filename,6,2).'/';
    }
}